import { request, METHOD } from '@/utils/request';
import qs from 'qs';
// 获取报文一级分类列表
export const getSmiListApi = () => {
  return request('/rep/repSmi/getList', METHOD.GET);
};

// 获取报文二级分类列表
export const getImiListApi = (params) => {
  return request('/rep/repImi/getListBySmi', METHOD.GET, params);
};

// 获取报文分类NODE列表
export const getNodeListBySmi = (params) => {
  return request('/rep/repImi/getNodeListBySmi', METHOD.GET, params);
};

/**
 * ========================================================
 * ************   模板管理   ************
 * ========================================================
 */

// 模板新增
export const addRepReportTemplateApi = (params) => {
  return request('/rep/repReportTemplate/addRepReportTemplate', METHOD.POST, params);
};

// 模板删除
export const deleteRepReportTemplateApi = (params) => {
  return request('/rep/repReportTemplate/deleteRepReportTemplate', METHOD.POST, qs.stringify(params));
};

// 获取模板列表
export const getRepReportTemplateListApi = (params) => {
  return request('/rep/repReportTemplate/getRepReportTemplateList', METHOD.POST, params);
};

// 模板修改
export const modifyRepReportTemplateApi = (params) => {
  return request('/rep/repReportTemplate/modifyRepReportTemplateById', METHOD.POST, params);
};

// 模板状态修改
export const modifyRepReportTemplateByEnableApi = (params) => {
  return request('/rep/repReportTemplate/modifyRepReportTemplateByEnable', METHOD.POST, params);
};

// 模板状态修改
export const getTemplateManagementApi = (params) => {
  return request(`/rep/repReportTemplate/getTemplateManagement`, METHOD.POST, qs.stringify(params));
};

// 新增
export const insertRepReportTemplateApi = (params) => {
  return request('/rep/repReportTemplate/insert', METHOD.POST, params);
};
// 修改
export const updateRepReportTemplateApi = (params) => {
  return request('/rep/repReportTemplate/update', METHOD.POST, params);
};

// 参数标签
export const getLabelParametersApi = (params) => {
  return request('/rep/repReportTemplate/getLabelParameters', METHOD.GET, params);
};

// 删除版本管理
export const deleteVMApi = (params) => {
  return request('/rep/repReportTemplate/delete', METHOD.POST, qs.stringify(params));
};
export const getVersionApi = (params) => {
  return request('/rep/repReportTemplate/getVersion', METHOD.POST, qs.stringify(params));
};
// 获取lableName
export const getLableNameApi = (params) => {
  return request('/rep/repReportTemplate/getLableName', METHOD.GET, params);
};

/**
 * ========================================================
 * ************   一级分类管理   ************
 * ========================================================
 */

// 一级分类新增
export const addRepSmiApi = (params) => {
  return request('/rep/repSmi/addRepSmi', METHOD.POST, params);
};

// 一级分类删除
export const deleteRepSmiApi = (params) => {
  return request('/rep/repSmi/deleteRepSmi', METHOD.POST, qs.stringify(params));
};

// 获取报文一级分类管理列表
export const getListByNameApi = (params) => {
  return request('/rep/repSmi/getListByName', METHOD.GET, params);
};

// 获取报文一级分类下未关联的二级分类列表
export const getListNotImiApi = (params) => {
  return request('/rep/repSmi/getListNotImi', METHOD.GET, params);
};

// 一级分类修改
export const modifyRepSmiApi = (params) => {
  return request('/rep/repSmi/modifyRepSmi', METHOD.POST, params);
};

// 修改一级分类的二级分类列表
export const modifyRepSmiByImiApi = (params) => {
  return request('/rep/repSmi/modifyRepSmiByImi', METHOD.POST, params);
};

/**
 * ========================================================
 * ************   二级分类管理   ************
 * ========================================================
 */

// 报文二级分类新增
export const addRepImiApi = (params) => {
  return request('/rep/repImi/addRepImi', METHOD.POST, params);
};

// 报文二级分类删除
export const deleteRepImiApi = (params) => {
  return request('/rep/repImi/deleteRepImi', METHOD.POST, qs.stringify(params));
};

// 报文二级分类管理列表
export const getListBySmiAndImiApi = (params) => {
  return request('/rep/repImi/getListBySmiAndImi', METHOD.GET, params);
};

// 报文二级分类编辑修改
export const modifyRepImiApi = (params) => {
  return request('/rep/repImi/modifyRepImi', METHOD.POST, params);
};

/**
 * ========================================================
 * ************   参数标签管理   ************
 * ========================================================
 */

// 新增标签
export const addRepReportParamLabelApi = (params) => {
  return request('/rep/repReportParamLabel/addRepReportParamLabel', METHOD.POST, params);
};

// 获取标签列表
export const getRepReportParamLabelListApi = (params = {}) => {
  return request('/rep/repReportParamLabel/getRepReportParamLabelList', METHOD.POST, params);
};
// 修改标签
export const modifyRepReportParamLabelApi = (params) => {
  return request('/rep/repReportParamLabel/modifyRepReportParamLabel', METHOD.POST, params);
};
// 删除标签
export const updateDeletedApi = (params) => {
  return request(`/rep/repReportParamLabel/updateDeleted?${qs.stringify(params, { arrayFormat: 'repeat' })}`, METHOD.GET);
};

/**
 * ========================================================
 * ************   分组管理   ************
 * ========================================================
 */

// 获取分组列表
export const getRepReportParamGroupListApi = (params) => {
  return request(`/rep/repReportParamGroup/getRepReportParamGroupList?${qs.stringify(params, { arrayFormat: 'repeat' })}`, METHOD.GET);
};

// 新增分组
export const addRepReportParamGroupApi = (params = {}) => {
  return request('/rep/repReportParamGroup/addRepReportParamGroup', METHOD.POST, params);
};

// 删除
export const removeRepReportParamGroupApi = (params = {}) => {
  return request('/rep/repReportParamGroup/removeRepReportParamGroup', METHOD.GET, params);
};
// 修改
export const modifyRepReportParamGroupApi = (params) => {
  return request('/rep/repReportParamGroup/modifyRepReportParamGroup', METHOD.POST, params);
};
// // 修改标签
// export const modifyRepReportParamLabelApi = (params) => {
//   return request('/rep/repReportParamLabel/modifyRepReportParamLabel', METHOD.POST, params);
// };

